<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>修改密码</title>
    <link rel="stylesheet" type="text/css" th:href="@{/css/personal.css}"/>
</head>
<body>
<div class="Top">
    <ul style="width: 300px;">
        <li><a th:href="@{/index/food}">首页</a></li>
        <li><a th:href="@{/index/hotFood}">热门</a></li>
        <li><a th:href="@{/index/evaluate}">用户评价</a></li>
    </ul>
    <ul style="width: 500px;">
        <li style="text-align: end;" th:if="${session.loginUser == null or session.loginUser == ''}"><a
                th:href="@{/login/toUserLogin}">登录</a></li>
        <li style="text-align: end;" th:if="${session.loginUser == null or session.loginUser == ''}"><a
                th:href="@{/login/toRegister}">注册</a></li>
        <li th:if="${session.loginUser != null and session.loginUser != ''}" class="Yonghu"
            style="position: relative;height: 34px;left: 60px;line-height: 34px;">当前用户：<span
                th:text="${session.loginUser.ofUserName}"/> <img th:src="@{/images/jianto.png}" alt=""
                                                                 style="width: 16px;margin-left: 10px;margin-bottom: -2.8px;">
            <div class="yonghu">
                <a th:href="@{/index/personal}">个人中心</a>
                <a th:href="@{/order/toOrder}">我的订单</a>
                <a th:href="@{/login/exitLogin}">退出登录</a>
            </div>
        </li>
        <li style="text-align: end;"><a th:href="@{/order/toCart}">购物车</a></li>
        <li style="text-align: center;"><a th:href="@{/login/toAdmin}" target="_blank">管理</a></li>
    </ul>
</div>
<div class="Top2">
    <div style="width: 100%;">
        <div class="center" style="width: 80%; margin: 0 auto;height: 120px;">
            <img th:src="@{/images/logo2.jpeg}" alt="" width="144px" style="float: left;">
            <div class="theme">
                <i>夏日美食</i>
            </div>
            <div style="float: right;margin-right: 150px;margin-top: 34px;">
                <i style="float: left;"><input class="input" name="search" id="search" type="text"></i>
                <i class="ione"><input type="image" name="submit" th:src="@{/images/search2.png}" width="25"
                                       height="25"></i>
            </div>
        </div>
    </div>
</div>
<div class="Personal">
    <div class="PersonalO">
        <div class="houtaio">
            <span style="font-size: 23px;color: rgb(181,181,181);">个人中心</span>
        </div>
        <div class="houtait">
            <h2 style="font-size: 18px;"><a th:href="@{/index/personal}">我的资料</a></h2>
        </div>
        <div class="houtait">
            <h2 style="font-size: 18px;"><a th:href="@{/order/toOrder}">个人订单</a></h2>
        </div>
        <div class="houtait">
            <h2 style="font-size: 18px;"><a style="color: coral;" th:href="@{/index/password}">修改密码</a></h2>
        </div>
        <div class="houtait">
            <h2 style="font-size: 18px;"><a th:href="@{/login/exitLogin}">退出登录</a></h2>
        </div>
    </div>
    <div class="PersonalT">
        <form method="get">
        <div class="ZL">
            <span class="zl">旧密码</span>&ensp;&ensp;<input type="text" id="oldpsw" name="oldpsw" required="" class="zlt"> <span id="oldpswmsg" style="margin-left: 20px;"></span>
        </div>
        <div class="ZL">
            <span class="zl">新密码</span>&ensp;&ensp;<input type="text" id="newpsw1" name="newpsw1" required="" class="zlt">
        </div>
        <div class="ZL">
            <span class="zl">确认密码</span><input type="text" id="newpsw2" name="newpsw2" required="" class="zlt"><span id="newpswmsg" style="margin-left: 20px;"></span>
        </div>
        <div class="ZL">
            <input type="button" id="save" name="submit" value="保存" class="zlo" style="background-color: rgb(87,163,243);">
        </div>
        </form>
    </div>
</div>
<div class="Footer">

    <div class="ffirst">
        <div>
            <i></i>
            <p>预约服务</p>
        </div>
        <div>
            <i></i>
            <p>退餐明示</p>
        </div>
        <div>
            <i></i>
            <p>免费赠品</p>
        </div>
        <div>
            <i></i>
            <p>满50元折扣</p>
        </div>
        <div>
            <i></i>
            <p>其它网店</p>
        </div>
    </div>
    <div class="Fsecond">
        <div class="fsecond-l">
            <div class="fsecond">
                <p>帮助中心</p>
                <ul>
                    <li>账户管理</li>
                    <li>订餐指南</li>
                    <li>订单操作</li>
                </ul>
            </div>
            <div class="fsecond">
                <p>服务支持</p>
                <ul>
                    <li>售后政策</li>
                    <li>自助服务</li>
                    <li>相关下载</li>
                </ul>
            </div>
            <div class="fsecond">
                <p>线下门店</p>
                <ul>
                    <li>美食之家</li>
                    <li>服务网点</li>
                    <li>授权体验店</li>
                </ul>
            </div>
            <div class="fsecond">
                <p>关于美食</p>
                <ul>
                    <li>了解美食</li>
                    <li>加入美食</li>
                    <li>订投资者关系</li>
                </ul>
            </div>
            <div class="fsecond">
                <p>关注我们</p>
                <ul>
                    <li>新浪微博</li>
                    <li>官方微信</li>
                    <li>联系我们</li>
                </ul>
            </div>
            <div class="fsecond">
                <p>特色服务</p>
                <ul>
                    <li>F码通道</li>
                    <li>礼物码</li>
                    <li>防伪查询</li>
                </ul>
            </div>
        </div>
        <div class="fsecond-R">
            <h2>400-100-5678</h2>
            <p>8:00-18:00(仅收市话费)</p>
            <div class="worker">
                <p>人工客服</p>
            </div>
            <div class="mi">关注夏日:
                <i><img th:src="@{/images/wb.png}" alt="" style="width: 45px;"></i>
                <i><img th:src="@{/images/wx.png}" alt=""></i>

            </div>
        </div>
    </div>
    <div class="Ffinaly">
        <div class="ffinaly">
            <img th:src="@{/images/erweima.png}" style="position: absolute;width: 79px;margin-left: 1093px;">
            <div class="one">
                <ul>
                    <li>夏日美食</li>
                    <li>MEISHI</li>
                    <li>服务</li>
                    <li>菜谱</li>
                    <li>有品</li>
                    <li>食材开放平台</li>
                    <li>活动</li>
                    <li>资质证照</li>
                    <li>政企服务</li>
                    <li>线下店</li>
                    <li>店铺安全隐私政策</li>
                    <li>食品安全隐私政策</li>
                    <li>夏日美食用户协议</li>
                    <li>问题反馈</li>
                </ul>
            </div>
            <div class="two">
                <p>
                    <a href="">© mi.com</a>
                    <a href="">京ICP证110507号</a>
                    <a href="">京ICP备10046444号</a>
                    <a href="">京公网安备11010802020134号</a>
                    <a href="">京网文[2020]0276-042号</a>
                </p>
                <p>
                    <a href="">（京）网械平台备字（2018）第00005号</a>
                    <a href="">互联网药品信息服务资格证 (京) -非经营性-2014-0090</a>
                    <a href="">营业执照</a>
                    <a href="">医疗器械公告</a>
                </p>
                <p>
                    <a href="">增值电信业务许可证 </a>
                    <a>网络食品经营备案京食药网食备202010048 </a>
                    <a href="">食品经营许可证</a>
                </p>
                <p>
                    <a>违法和不良信息举报电话：171-5104-4404</a>
                    <a href="">知识产权侵权投诉</a>
                    <a>本网站所列数据，除特殊说明，所有数据均出自我司实验室测试</a>
                </p>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" th:src="@{/js/jquery-3.4.1.min.js}"></script>
<script>
    var save = document.getElementById('save');

    save.onclick = function () {
        var oldpsw = $("#oldpsw").val();
        var newpsw1 = $("#newpsw1").val();
        var newpsw2 = $("#newpsw2").val();
        if (newpsw1==newpsw2){
            $.ajax({
                url:"/user/modifypsw",
                type:'post',
                data:JSON.stringify({oldpsw:oldpsw,newpsw:newpsw2}),
                dataType:'json',
                contentType:'application/json',
                success:function (data) {
                    if (data.code=='200'){
                        alert("修改成功！");
                        window.location.href="/index/personal"
                    }else{
                        $("#oldpswmsg").text(data.msg);
                    }
                }
            });
        }else{
            $("#newpswmsg").text('两次密码不一样！');
        }
    }
</script>
</body>
</html>